#ifndef __BUOLA_GUI_CZOOMHELPER_H__
#define __BUOLA_GUI_CZOOMHELPER_H__

#include <buola/gui.h>
#include <buola/utility/usignal.h>

namespace buola { namespace gui {

class CZoomHelper
{
public:
    CZoomHelper();

    void Zoom(double pFactor,const CPoint_d &pOrigin=CPoint_d(nZero));
    void Pan(const CPoint_d &pPan);

    void One();
    void Fit(const CRect_d &pWin,const CRect_d &pRect);

    void Apply(img::CGC *pGC);
    void ApplyInverse(img::CGC *pGC);

    CPoint_d ToDevice(const CPoint_d &pPoint)   {   return pPoint*mZoom+mPan;   }
    CPoint_d ToClient(const CPoint_d &pPoint)   {   return (pPoint-mPan)/mZoom; }

    USignal<void()> sChanged;

    double mZoom;
    CPoint_d mPan;
};

/*namespace gui*/ } /*namespace buola*/ }

#endif
